<template>
  <div class="fm">
    <van-nav-bar
      title="首页"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <ul>
      <li v-for="item in fmlist" :key="item.id" @click="godailt(item.id)">
        <img class="img" :src="item.album.picUrl" alt="" />
        <div>
          <div>
            <p>{{ item.name }}</p>
          </div>
          <div v-for="v in item.artists" :key="v.id" class="div">
            <span> {{ v.name }} -- {{ item.name }}</span>
          </div>
        </div>
        <div class="right">
          <van-icon name="play-circle-o" size="21" color="#B3B3B3" />
          <van-icon name="weapp-nav" class="weapp" />
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      fmlist: [],
    };
  },
  computed: {},
  watch: {},

  methods: {
    async fmList() {
      axios
        .get("http://localhost:3000/personal_fm", {
          withCredentials: true, //cookie跨域
        })
        .then((res) => {
          console.log("私人fm", res);
          this.fmlist = res.data.data;
        });
    },
    //点击跳转歌曲详情
    gosongDetail(id) {
      this.$router.push(`/songdetail/${id}`);
    },
    onClickLeft() {
      this.$router.go(-1);
    },
  },
  created() {},
  mounted() {
    this.fmList();
  },
  components: {},
};
</script>
<style scoped>
.img {
  width: 80px;
  height: 80px;
  margin-right: 15px;
  border-radius: 10px;
}
.div {
  height: 80px;
  line-height: 80px;
  color: rgb(134, 133, 133);
  width: 230px;
  overflow: hidden;
  /*文本不换行*/
  white-space: nowrap;
  /*文字超出用省略号*/
  text-overflow: ellipsis;
}
p {
  font-size: 20px;
  width: 180px;
  overflow: hidden;
  /*文本不换行*/
  white-space: nowrap;
  /*文字超出用省略号*/
  text-overflow: ellipsis;
}

li {
  display: flex;
  margin-top: 20px;
  margin-left: 15px;
  position: relative;
}
ul {
  margin-bottom: 40px;
}
.right {
  /* display: flex; */
  position: absolute;
  right: 0px;
  top: 20px;
}
.van-icon:before {
  margin-left: 15px;
  /* margin-right: 10px; */
  font-size: 25px;
}
.img1 {
  width: 100%;
  height: 300px;
  /* position: fixed;
  top: 0; */
  z-index: -1;
}
.nav {
  width: 100%;
  height: 250px;
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
  height: 200px;
}
.swipe {
  width: 100%;
  height: 200px;
}
.play {
  margin: 20px 0;
  position: relative;
}
.play1 {
  font-size: 25px;
  margin-left: 10px;
}
.play b {
  position: absolute;
  right: 15px;
  font-size: 30px;
}
</style>
